package com.sun.evening.service.impl;

import com.sun.evening.core.common.Result;
import com.sun.evening.dao.vo.PictureListVo;
import com.sun.evening.manager.service.PictureServer;
import com.sun.evening.service.PictureService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PictureServiceImpl implements PictureService {
    @Resource
    private PictureServer pictureServer;
    @Override
    @ApiModelProperty("根据图片名获取带有临时链接地址的视图对象")
    public Result selectByPictureName(String pictureName) {
        PictureListVo pictureListVo=pictureServer.getPictureUrl(pictureName);
        if (pictureListVo.getPictureUrl()==null){
            return Result.fail("不存在该图片");
        }
        return Result.success(pictureListVo);
    }

    @Override
    public Result insertPictureByVo(PictureListVo pictureListVo){
        //使用redis缓存存储点击量

        return null;
    }
}
